﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="DisqualifyReasonsReport.aspx.cs" Inherits="MLY.Reports.ChartReports.DisqualifyReasonsReport" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>

<%@ Register Assembly="System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    Namespace="System.Web.UI.DataVisualization.Charting" TagPrefix="asp" %> 

<%@ Register Assembly="DevExpress.Web.v11.1.Linq, Version=11.1.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Data.Linq" TagPrefix="dx" %>

<%@ Register Assembly="DevExpress.Web.ASPxGridView.v11.1, Version=11.1.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
  Namespace="DevExpress.Web.ASPxGridView" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.ASPxEditors.v11.1, Version=11.1.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
  Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v11.1, Version=11.1.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web.ASPxPanel"
  TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v11.1, Version=11.1.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web.ASPxRoundPanel"
  TagPrefix="dx" %>
<%@ Register assembly="DevExpress.Web.v11.1, Version=11.1.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxLoadingPanel" tagprefix="dx" %>
<%@ Register assembly="DevExpress.Web.ASPxGridView.v11.1, Version=11.1.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxGridView" tagprefix="dx" %>
<%@ Register assembly="DevExpress.Web.ASPxEditors.v11.1, Version=11.1.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxEditors" tagprefix="dx" %>
<%@ Register assembly="DevExpress.Web.ASPxGridView.v11.1.Export, Version=11.1.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxGridView.Export" tagprefix="dx" %>


<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <meta http-equiv="X-UA-Compatible" content="IE=9" />
    <title><asp:Literal ID="TitleLiteral" runat="server" Text="<%$ Dict:reportsParams.DisqualifyReasonsTitle %>"></asp:Literal></title>
    
    <link href="/Style/General_Style_v9.css" rel="stylesheet" type="text/css" />
    <link href="../../Style/ReportsStylesheet.css" rel="stylesheet" type="text/css" />
   
    <script src="../../TableSorter/jquery-latest.js" type="text/javascript"></script>
    <script src="../../TableSorter/jquery.tablesorter.js" type="text/javascript"></script>  
    
    <style type="text/css">
        .tabheader
        {
            font-family:Arial;
            font-size:14px;
            background-color:rgb(128,128,218);
            color:Black;
            padding:5px;
            margin:5px;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ToolkitScriptManager ID="ScriptManager1" runat="server"></asp:ToolkitScriptManager>
        

        <asp:Panel ID="ReportDefinitionsPanel" runat="server">
            <table cellpadding="5" cellspacing="0">
            <tr>
            <td>
                <asp:Label ID="OrganizationTitleLabel" Text='<%$Dict:reportsParams.ChooseOrganization: %>' runat="server"></asp:Label>
            </td>
            <td>
                <asp:DropDownList ID="ddlOrgs" runat="server" DataTextField="OrganizationName" DataValueField="OrganizationId" OnLoad="ddlOrgs_Load">
                </asp:DropDownList>
            </td>
            <td>
                <asp:Label ID="DateStringTitleLabel" runat="server" Text='<%$Dict:advancedRptPrams.chooseDateFilter: %>'></asp:Label>
            </td>
            <td>
                <asp:DropDownList runat="server" ID="DateTypesDDL">
                    <asp:ListItem Text="<%$Dict:clientAddWo.SendDate %>" Value="1"></asp:ListItem>
                    <asp:ListItem Text="<%$Dict:clientAddWo.RequestedDelivaryDate %>" Value="2"></asp:ListItem>
                    <asp:ListItem Text="<%$Dict:clientAddWo.PlannedDelivaryDate %>" Value="3"></asp:ListItem>                        
                    <asp:ListItem Text="<%$Dict:clientAddWo.DateFieldB %>" Value="4"></asp:ListItem>
                </asp:DropDownList>
            </td>
            </tr>
            <tr>
            <td>
                <asp:Label ID="DateFromTitleLabel" runat="server" Text='<%$Dict:reportsParams.Between %>'></asp:Label>
            </td>
            <td>
                <KBMControls:KBMReadOnlyTxtBox runat="server" ID="txtFromDate"></KBMControls:KBMReadOnlyTxtBox>
                <KBMValidators:requiredValidator ID="RequiredValidator1" runat="server" ControlToValidate="txtFromDate" ErrorMessage='<%$Dict:reportsParams.MustChooseBetweenTime %>'>
                </KBMValidators:requiredValidator>
                <KBMControls:KbmCalendar TargetControlID="txtFromDate" runat="server" ID="KbmCalendar1">
                </KBMControls:KbmCalendar>
            </td>
            
            <td>
                <asp:Label ID="DateTillTitleLabel"  runat="server"  Text='<%$Dict:reportsParams.And %>'></asp:Label>
            </td>
            <td>
                <KBMControls:KBMReadOnlyTxtBox runat="server" ID="txtToDate"></KBMControls:KBMReadOnlyTxtBox>
                <%--<KBMValidators:BiggerThenEqualDateValidator ID="BiggerThenEqualDateValidator1" Display="None"
                    errorMessage='<%$Dict:reportsParams.ToDateSmallerThenFromDate %>' ControlToCompare="txtFromDate"
                    ControlToValidate="txtToDate" runat="server"></KBMValidators:BiggerThenEqualDateValidator>--%>
                <KBMValidators:requiredValidator ID="RequiredValidator2" ControlToValidate="txtToDate" ErrorMessage='<%$Dict:reportsParams.MustChooseToDate %>'
                    runat="server"></KBMValidators:requiredValidator>
                <KBMControls:KbmCalendar TargetControlID="txtToDate" runat="server" ID="Calendar1">
                </KBMControls:KbmCalendar>
            </td>
            </tr>
            <tr>
            <td>
                <asp:Label ID="DisqualifyReaonTitleLabel" runat="server" Text='<%$ Dict:reportsParams.DisqualifyReasons %>'></asp:Label>
            </td>
            <td colspan="3">
                <asp:DropDownList ID="DisqualifyReasonsDDL" runat="server" DataTextField="ReasonId" DataValueField="ReasonName" OnLoad="ReasonsListLoad"></asp:DropDownList>
            </td>
            </tr>
            <tr>
            <td>
                <asp:Label ID="TrendsDDLTitleLabel" runat="server" Text="<%$ Dict:reports.TrendsChartName %>"></asp:Label>
            </td>
            <td colspan="3">
                <asp:DropDownList ID="TrendsDDL" runat="server">
                    <asp:ListItem Text="<%$ Dict:reports.Weekly %>" Value="7"></asp:ListItem>
                    <asp:ListItem Text="<%$ Dict:reports.Monthly %>" Value="30"></asp:ListItem>
                </asp:DropDownList>
            </td>
            </tr>
            <tr>
            <td>
                <asp:Label ID="QCStageTitle" runat="server" Text="<%$ Dict:DisqualifyReport.DisqualifyStage %>"></asp:Label>
            </td>
            <td colspan="3">
                <asp:DropDownList ID="QCStageDDL" runat="server">
                    <asp:ListItem Value="0" Text="All"></asp:ListItem>
                    <asp:ListItem Value="1" Text="<%$ Dict:DisqualifyReport.INQC %>"></asp:ListItem>
                    <asp:ListItem Value="2" Text="<%$ Dict:DisqualifyReport.BeforeQC %>"></asp:ListItem>
                </asp:DropDownList>
            </td>
            </tr>
            <tr>
            <td>
                <asp:Label ID="Reportlabel" runat=
            </td>
            </tr>
            <tr>
            <td>
            <asp:Button ID="GenerateReportButton" runat="server" Text="<%$ Dict:Reports.GenerateReport %>" OnClick="GenerateReport" />  
            </td>
            <td colspan="3">                
                <%--<asp:UpdateProgress ID="Progress" runat="server" AssociatedUpdatePanelID="UpdatePanel1">
                    <ProgressTemplate>
                        <asp:Image ID="ProgressImage" runat="server" ImageUrl="~/Images/ajax-loaderBar.gif" />
                    </ProgressTemplate>
                </asp:UpdateProgress>  --%>        
            </td>
            </tr>
            
            </table>
            <br />
            
        </asp:Panel>
        <asp:Panel ID="ReportPanel" runat="server" Visible="false">
            <br /><hr /><br />
            <asp:TabContainer ID="ReportTabContaier" runat="server">
            <asp:TabPanel ID="DisqualifyReasonsChartTab" runat="server" >
            <HeaderTemplate>
                <asp:Label ID="DisqualifyReasonsChartTitle" runat="server" Text="<%$ Dict:reportsParams.DisqualifyReasons %>"></asp:Label>                  

            </HeaderTemplate>
            <ContentTemplate>
            
            
            <asp:Chart ID="DisqualifyReasonsChart" runat="server" Width="800" Height="320"
             ImageLocation="~/Images/ChartsJunk" ImageStorageMode="UseImageLocation" ImageType="Png"
             XValueType="Double" Name="Series1" ChartType="Pie" Font="Trebuchet MS, 8.25pt, style=Bold" 
             CustomProperties="DoughnutRadius=25, PieDrawingStyle=Concave, CollectedLabel=Other, MinimumRelativePieSize=1" 
             MarkerStyle="Circle" BorderColor="64, 64, 64, 64" Color="180, 65, 140, 240" YValueType="Double" Label="#PERCENT{P1}">
                <Titles>
                    <asp:Title Name="Title1" Text="<%$ Dict:reportsParams.DisqualifyReasons %>" Alignment="TopCenter" Font="Arial, 14px, style=Bold"></asp:Title>
                </Titles> 
                <Legends>
                    <asp:Legend IsTextAutoFit="true" Name="Default" Font="Arial, 12px, style=Bold" Docking="Right" ></asp:Legend>                
                </Legends>
                <Series>
                    <asp:Series Name="<%$Dict:reportsParams.DisqualifyReasons %>" ChartType="Pie" IsValueShownAsLabel="true" ></asp:Series>                
                </Series>
                <chartareas>
					<asp:ChartArea Name="Area1" BorderColor="64, 64, 64, 64" BackSecondaryColor="Transparent"
					 BackColor="Transparent" ShadowColor="Transparent" BackGradientStyle="TopBottom">
						<axisy2>
							<MajorGrid Enabled="False" />
							<MajorTickMark Enabled="False" />
						</axisy2>
						<axisx2>
							<MajorGrid Enabled="False" />
							<MajorTickMark Enabled="False" />
						</axisx2>
						<area3dstyle PointGapDepth="900" Rotation="162" IsRightAngleAxes="False" WallWidth="25" IsClustered="False" />
						<axisy LineColor="64, 64, 64, 64">
							<LabelStyle Font="Trebuchet MS, 8.25pt, style=Bold" />
							<MajorGrid LineColor="64, 64, 64, 64" Enabled="False" />
							<MajorTickMark Enabled="False" />
						</axisy>
						<axisx LineColor="64, 64, 64, 64">
							<LabelStyle Font="Trebuchet MS, 8.25pt, style=Bold" />
							<MajorGrid LineColor="64, 64, 64, 64" Enabled="False" />
							<MajorTickMark Enabled="False" />
						</axisx>
					</asp:ChartArea>
				</chartareas>
            </asp:Chart>
            </ContentTemplate>
            </asp:TabPanel>
            <asp:TabPanel ID="OrgChartsTabPanel" runat="server">
                <HeaderTemplate>
                    <asp:Label ID="OrgChartsTitleLabel" runat="server" Text="<%$ Dict:OrgsGrid.Title %>"></asp:Label>
                </HeaderTemplate>
                <ContentTemplate>
                    <asp:Panel ID="OrgChartsContainer" runat="server"></asp:Panel>
                </ContentTemplate>
            </asp:TabPanel>
            <asp:TabPanel ID="TrendsChartTabPanel" runat="server">
                <HeaderTemplate>
                    <asp:Label ID="TrendsChartTitle" runat="server" Text="<%$ Dict:reports.TrendsChartName %>"></asp:Label>
                </HeaderTemplate>
                <ContentTemplate>
                    <asp:chart id="TrendsChart" runat="server" ImageLocation="~/Images/OrgsChart" imagetype="Png" BackColor="White" 
                        BorderWidth="2" BackGradientStyle="TopBottom" BackSecondaryColor="White"  
                        BorderDashStyle="Solid" BorderColor="26, 59, 105" Height="320px" Width="800px">
				            <titles>
					            <asp:title ShadowColor="32, 0, 0, 0" Font="Arial, 14px, style=Bold" ShadowOffset="3" Text="<%$ Dict:reports.TrendsChartName %>" ForeColor="26, 59, 105"></asp:title>
				            </titles>
				            <legends>
					            <asp:legend Enabled="False" IsTextAutoFit="False" Name="Default" BackColor="Transparent" Font="Trebuchet MS, 8.25pt, style=Bold" Docking="Right"></asp:legend>
				            </legends>
            				
				            <series>
					            <asp:series Name="Series1" ChartType="Line" ShadowColor="Black" BorderColor="180, 26, 59, 105" IsValueShownAsLabel="true"></asp:series>
				            </series>
				            <chartareas>
					            <asp:chartarea Name="ChartArea1" BorderColor="64, 64, 64, 64" BorderDashStyle="Solid" BackSecondaryColor="White" BackColor="Gainsboro" 
					                ShadowColor="Transparent" BackGradientStyle="TopBottom">
						            <area3dstyle Rotation="10" perspective="10" Inclination="15" IsRightAngleAxes="False" wallwidth="0" IsClustered="False"></area3dstyle>
						            <axisy linecolor="64, 64, 64, 64" IsLabelAutoFit="False">
							            <labelstyle font="Trebuchet MS, 8.25pt, style=Bold" />
							            <majorgrid linecolor="64, 64, 64, 64" />
						            </axisy>
						            <axisx linecolor="64, 64, 64, 64" IsLabelAutoFit="False">
							            <labelstyle font="Trebuchet MS, 8.25pt, style=Bold" />
							            <majorgrid linecolor="64, 64, 64, 64" />
						            </axisx>
					            </asp:chartarea>
				            </chartareas>
			            </asp:chart>
                </ContentTemplate>
            </asp:TabPanel>
            <asp:TabPanel ID="DisqualifyReasonsTabPanel" runat="server" >
                <HeaderTemplate>
                    <asp:Label ID="DisqualifyReasonsTabTitleLabel" runat="server" Text="<%$ Dict:reportsParams.DisqualifyReasonsTitle %>"></asp:Label>
                </HeaderTemplate>
                <ContentTemplate>
                <asp:Label ID="DisqualifyReasonsTitleLabel" runat="server" Text="<%$ Dict:reportsParams.DisqualifyReasonsTitle %>" CssClass="TitleStyle floater"></asp:Label>
            <%--    <asp:GridView ID="ReportGrid" runat="server" DataSourceID="RowDisqualifyDataSource" 
                AllowPaging="true" AutoGenerateColumns="false">
                <HeaderStyle CssClass="GridTitleStyle" />
                </asp:GridView>--%>
                <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                <Triggers>
                    <asp:PostBackTrigger ControlID="ExportToXLS" />
                    <asp:PostBackTrigger ControlID="ExportToXLSx" />          
                </Triggers>
                <ContentTemplate>
           <dx:ASPxGridView ID="ReportGrid" runat="server"  
             DataSourceID="RowDisqualifyDataSource"
             EnableCallBacks="False" SettingsPager-RenderMode="Lightweight"
             EnableTheming="False" 
             KeyFieldName="CustomerWorkOrderNumber" 
             Settings-ShowFilterRow="true" 
             Settings-ShowGroupButtons="true"
             Settings-ShowFilterBar="Hidden" Settings-ShowFilterRowMenu="True"
             Settings-ShowGroupedColumns="True" Settings-ShowGroupPanel="True" 
             Settings-UseFixedTableLayout="True" >
            <SettingsBehavior AllowFocusedRow="True" ColumnResizeMode="NextColumn" AutoFilterRowInputDelay="2500"  />
            <SettingsPager RenderMode="Lightweight"></SettingsPager>
            <Styles Header-Wrap="True"></Styles>
            <Columns>
                <dx:GridViewDataTextColumn Caption="<%$ Dict:adminDefault.Organizations %>" FieldName="OrgName"></dx:GridViewDataTextColumn>
                <dx:GridViewDataTextColumn Caption="<%$ Dict:ClienteditWoForm.CustomerCatalougeCode %>"  Width="100" FieldName="CustomerCatalougeCode"></dx:GridViewDataTextColumn>
                <dx:GridViewDataTextColumn Caption="<%$ Dict:clientAddWo.CustomerWorkOrderNumber %>" FieldName="CustomerWorkOrderNumber"></dx:GridViewDataTextColumn>
                <dx:GridViewDataTextColumn Caption="<%$ Dict:InventoryGrid.ContrCatalogueCodeColumn %>" FieldName="ContractorCatalougeCode"></dx:GridViewDataTextColumn>
                <dx:GridViewDataTextColumn Caption="<%$ Dict:clientAddWo.ContractorWorkOrderNumber %>" FieldName="ContractorWorkOrderNumber"></dx:GridViewDataTextColumn>
                <dx:GridViewDataTextColumn Caption="<%$ Dict:InventoryGrid.QuantityColumn %>" FieldName="Quantity"></dx:GridViewDataTextColumn>
                <dx:GridViewDataTextColumn Caption="<%$ Dict:InventoryGrid.ProductDescriptionColumn %>"  Width="200" FieldName="ProductDescription"  ></dx:GridViewDataTextColumn>
                <dx:GridViewDataDateColumn Caption="<%$ Dict:InventoryGrid.SendDateColumn %>" FieldName="SendDate" ></dx:GridViewDataDateColumn>
                <dx:GridViewDataDateColumn Caption="<%$ Dict:ClienteditWoForm.RequestedDelivaryDate %>" FieldName="RequestedDelivaryDate" ></dx:GridViewDataDateColumn>
                <dx:GridViewDataDateColumn Caption="<%$ Dict:ClienteditWoForm.PlannedDelivaryDate %>" FieldName="PlannedDelivaryDate" ></dx:GridViewDataDateColumn>
                <dx:GridViewDataDateColumn Caption="<%$ Dict:InventoryGrid.DateBColumn %>" FieldName="DateFieldB" ></dx:GridViewDataDateColumn>
                <dx:GridViewDataTextColumn Caption="<%$ Dict:reportsParams.DisqualifyReasons %>" FieldName="ReasonsList" Width="200"></dx:GridViewDataTextColumn>
                
            </Columns>
            </dx:ASPxGridView>
            <dx:ASPxGridViewExporter ID="gridExport" runat="server" GridViewID="ReportGrid"></dx:ASPxGridViewExporter>
            <table cellpadding="5" cellspacing="0">
                <tr>
                <td>
                    <dx:ASPxButton Id="ExportToXLS" runat="server" Text="Export to XLS" UseSubmitBehavior="False"
                        OnClick="btnXlsExport_Click"   ></dx:ASPxButton>
                                      
                </td>
                <td>
                    <dx:ASPxButton Id="ExportToXLSx" runat="server" Text="Export to XLSx" UseSubmitBehavior="False"
                        OnClick="btnXlsxExport_Click"></dx:ASPxButton>
                </td>                
                </tr>
            </table>     
            
            <asp:SqlDataSource ID="RowDisqualifyDataSource" runat="server" SelectCommandType="StoredProcedure"
            ConnectionString="<%$ ConnectionStrings:MLYConnectionString %>" SelectCommand="SCCover_DisqualifyReportRawData"></asp:SqlDataSource> 
              
                </ContentTemplate>
                </asp:UpdatePanel>
            </ContentTemplate>
            
            </asp:TabPanel>
            </asp:TabContainer>
            
            <%--<asp:Chart ID="OrgsChart" runat="server" Width="800" Height="320"
             ImageLocation="~/Images/OrgsChart" ImageStorageMode="UseImageLocation" ImageType="Png"
             Name="Series1" ChartType="Pie" Font="Trebuchet MS, 8.25pt, style=Bold" 
             CustomProperties="DoughnutRadius=25, PieDrawingStyle=Concave, CollectedLabel=Other, MinimumRelativePieSize=1" 
             MarkerStyle="Circle" BorderColor="64, 64, 64, 64" Color="180, 65, 140, 240" YValueType="Double" Label="#PERCENT{P1}">
                <Titles>
                    <asp:Title Name="Title1" Text="<%$ Dict:OrgsGrid.Title %>" Alignment="TopCenter" Font="Arial, 14px, style=Bold"></asp:Title>
                </Titles> 
                <Legends>
                    <asp:Legend IsTextAutoFit="true" Name="Default" Font="Arial, 12px, style=Bold" Docking="Right" ></asp:Legend>                
                </Legends>
                <Series>
                    <asp:Series Name="<%$ Dict:clientAddWo.OriginalQuantity %>" BorderColor="180, 26, 59, 105" IsValueShownAsLabel="true"></asp:Series>            
                    <asp:Series Name="<%$ Dict:reports.DisqualifiedQuantity %>" BorderColor="180, 26, 59, 105" IsValueShownAsLabel="true"></asp:Series>
                </Series>
                <chartareas>
					<asp:ChartArea  Name="ChartArea1" BorderColor="64, 64, 64, 64" BorderDashStyle="Solid" BackSecondaryColor="White" 
                    BackColor="Gainsboro" ShadowColor="Transparent" BackGradientStyle="TopBottom" >
                        <area3dstyle Rotation="10" perspective="10" Inclination="15" IsRightAngleAxes="False" wallwidth="0" IsClustered="False"></area3dstyle>
				        <axisy linecolor="64, 64, 64, 64" IsLabelAutoFit="False" Interval="Auto">
					        <labelstyle font="Arial, 8.25pt, style=Bold" />
					        <majorgrid linecolor="64, 64, 64, 64" />
				        </axisy>
				        <axisx linecolor="64, 64, 64, 64" IsLabelAutoFit="False">
					        <labelstyle font="Arial, 8.25pt, style=Bold" IsStaggered="True" />
					        <majorgrid linecolor="64, 64, 64, 64" />
                            
				        </axisx>                    
			        </asp:ChartArea>
				</chartareas>
            </asp:Chart>--%>

            

            
        </asp:Panel>
        
    </div>
    </form>
</body>
</html>
